package org.bean.box.tcp;

import org.apache.mina.core.session.IoSession;
import org.apache.mina.filter.codec.ProtocolCodecFactory;
import org.apache.mina.filter.codec.ProtocolDecoder;
import org.apache.mina.filter.codec.ProtocolEncoder;

public class TcpFactory implements ProtocolCodecFactory {

    private TcpEncoder encoder;
    private TcpDecoder decoder;

    public TcpFactory() {
        encoder = new TcpEncoder();
        decoder = new TcpDecoder();
    }
    /**
     *
     * @param session
     * @return
     * @throws Exception
     */
    @Override
    public ProtocolEncoder getEncoder(IoSession session) throws Exception {
        return encoder;
    }

    /**
     *
     * @param session
     * @return
     * @throws Exception
     */
    @Override
    public ProtocolDecoder getDecoder(IoSession session) throws Exception {
        return decoder;
    }
}
